#include "EncryptionZ.h"

EncryptionZ::EncryptionZ()
{

}


#include "qaesencryption.h"
#include <QCryptographicHash>


void JiaMi(QString _strHashKey, QString _strMingWen, QString *_pstrMiWen)// 明文 密文
{
    QAESEncryption encryption(QAESEncryption::AES_128, QAESEncryption::ECB, QAESEncryption::ZERO);
    QByteArray hashKey = QCryptographicHash::hash(_strHashKey.toUtf8(), QCryptographicHash::Md5);
    QByteArray encodedText = encryption.encode(_strMingWen.toUtf8(), hashKey);
    *_pstrMiWen = encodedText.toBase64();
}

void JieMi(QString _strHashKey, QString _strMiWen, QString *_pstrMingWen)// 密文 明文
{
    QAESEncryption encryption(QAESEncryption::AES_128, QAESEncryption::ECB, QAESEncryption::ZERO);
    QByteArray hashKey = QCryptographicHash::hash(_strHashKey.toUtf8(), QCryptographicHash::Md5);
    QByteArray decodedText = encryption.decode(QByteArray::fromBase64(_strMiWen.toLatin1()), hashKey);
    *_pstrMingWen = QString::fromUtf8(decodedText);
}
